{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Blind wine tasting\n", "## Problem Definition\n", "María and Alberto (names have been selected randomly, any resemblance with reality is pure coincidence) are two classmates that want to celebrate the end of the course with a game. They will go to their favourite bar and Alberto will randomly select a bottle of wine from the wine list. María will do a blind testing of the wine, with no possibility to see the wine selected by Alberto. If María guesses the type of wine (red or white) just by holding her glass, Alberto will pay 20€. Otherwise, if she fails, María will pay Alberto 10€. She may also taste the wine for 5€ (that is, Alberto will discount 5€ of the bet if she guesses the type of wine, or María will pay 5€ extra if she does not).\n", "\n", "María thinks she can use decision theory to improve her chances of winning the bet. She knows that in the wine list of their favourite bar, there are 15 bottles of red wine and 11 of white wine. She has also done some blind wine tasting to prepare for the bet and found out that it is actually not that easy to guess the colour of the wine just by tasting it blindfolded. She guessed correctly 3/4 of the times she tried a white wine and 2/4 of the times she tried a red wine.\n", "\n", "**a** Draw the decision tree for María without taking into account that she may test the wine to get additional information.\n", "\n", "In this option, we only consider the possibility that María guesses the type of wine just by holding the glass of wine. In this scenario, there is only one decision node, with two alternatives, either white wine or red wine. For every alternative, we can model the selection of Alberto as a random event, without any María's control. Without further information, let us consider that all wines have the same probability of being selected by Alberto. Under this assumption, each random node has two possible states:\n", "\n", "- White wine: Alberto selects a white wine with probability $P(W) = 11/26$\n", "- Red wine: Alberto selects a red wine with probability $P(R) = 15/26$\n", "\n", "Now, since María gets 20€ when she correctly guesses the type of wine and -10 otherwise, the decision tree is:\n", "\n", "![Decision tree without additional info](img/wine_tasting.png)\n", "\n", "**b** Modify the decision tree for María now taking into account that she may test the wine.\n", "Now, to modify the decision tree taking into account that she may test the wine, we need to introduce a new decision node to model the decision of tasting the wine or not. Given that we have the record of attempts of María, we can assume that tasting the wine will provide to María additional imperfect information about the type of wine, and model the result of the tasting through a random node with two different alternatives: \n", "\n", "- María tastes the wine, and she thinks it tastes like white wine: $P(TW)$\n", "- María tastes the wine, and she thinks it tastes like red wine: $P(TW)$\n", "\n", "Note that tasting the wine and choosing the wine are not the same think. María may test the wine and then trust her taste or not, taking into account the reliability of previous tests, for which we have information. \n", "\n", "With this, the decision tree becomes: \n", "\n", "![Decision tree with additional info](img/wine_tasting_additional_info.png)\n", "\n", "We can calculate the posterior probabilities from the record of tests conducted by María, applying Bayes. From her tests we know that: \n", "\n", "- Probability that María tasted a white wine given that the wine was actually white $P(TW|W): 3/4$\n", "- Probability that María tasted a white wine given that the wine was actually red $P(TW|R): 2/4$\n", "- Probability that María tasted a red wine given that the wine was actually red $P(TR|R): 2/4$\n", "- Probability that María tasted a red wine given that the wine was actually white $P(TR|W): 1/4$\n", "\n", "Now, using the law of total probability we can calculate the probabilities of tasting a white wine and a red wine: \n", "\n", "$P(TW) = P(TW|W)*P(W) + P(TW|R)*P(R) = 3/4*11/26 + 2/4*15/26 = 0.605$\n", "\n", "$P(TR) = P(TR|R)*P(R) + P(TR|W)*P(W) = 2/4*15/26 + 1/4*11/26 = 0.394$\n", "\n", "And from these results, we can calculate the posterior probabilities using Bayes: \n", "\n", "$P(W|TW) = P(TW|W)*P(W)/P(TW) = 3/4*11/26 / (0.605) = 0.52$\n", "\n", "$P(R|TW) = P(TW|R)*P(R)/P(TW) = 2/4*15/26 / (0.605) = 0.48$\n", "\n", "$P(W|TR) = P(TR|W)*P(W)/P(TR) = 1/4*11/26 / (0.394) = 0.27$\n", "\n", "$P(R|TR) = P(TR|R)*P(R)/P(TR) = 2/4*15/26/ (0.394) = 0.73$\n", "\n", "Note that the information of the tests is not very reliable, specially when María tests the red wine, this is an important fact to consider when we calculate the tree.\n", "\n", "**c** What is the best alternative for María? \n", "\n", "Now, to solve the tree, we need to calculate the values of the nodes: \n", "\n", "$V_3 = 20*11/26 - 10*15/26 = 70/26$\n", "$V_6 = -10*11/26 + 20*15/26 = 190/26$\n", "\n", "$V_2 = \\max(V_3, V_6) = 190/26 = 7.3$\n", "\n", "$V_{11} = 20*0.52 -10*0.48 = 5.6$\n", "\n", "$V_{14} = -10*0.52 + 20*0.48 = 4.4$\n", "\n", "$V_{10} = \\max(V_{11}, V_{14}) = 5.6$\n", "\n", "$V_{18} = 20*0.27 - 10*0.73 = -1.9$\n", "\n", "$V_{21} = -10*0.27 + 20*0.73 = 11.9$\n", "\n", "$V_{17} = \\max(V_{18}, V_{21}) = 11.9$\n", "\n", "$V_9 = 0.605*5.6 + 0.394*11.9 = 8.08$\n", "\n", "$V_1 = \\max(7.3, 8.08-5) = 7.3$\n", "\n", "According to the tree, María should try to guess the type of wine just by holding the glass and just guess that is a red wine. This is also a logical conclusion taking into account that the tests she conducted showed that tasting the wine was not a very reliable source of information." ] } ], "metadata": { "kernelspec": { "display_name": "${KERNEL_SPEC_DISPLAY_NAME}", "language": "${KERNEL_SPEC_LANGUAGE}", "name": "${KERNEL_SPEC_NAME}" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }